import Vue from 'vue'
import VueRouter from 'vue-router'
import login from '../views/login/index'
import layout from '../views/layout/index'
import home from '../views/home/index'
import wenda from '../views/wenda/index'
import video from '../views/video/index'
import my from '../views/my/index'
import atrcle from '../views/atrcle/atrcle'
// import { search } from 'core-js/fn/symbol'
import search from '@/views/search'
import setuser from "@/views/my/components/setuser.vue";
Vue.use(VueRouter)
// 路由表
const routes = [
  // 登录
  {
    path: '/login',
    name: 'login',
    component: login
  },
  //首页
  {
    path: '/',
    // 重定向至我的页面
    // redirect: '/layout',
    component: layout,
    children: [
      // 首页
      { path: '', component: home },
      // 问答
      { path: '/wenda', component: wenda },
      // 视频
      { path: '/video', component: video },
      // 我的
      {
        path: '/my', component: my,
      }
    ]
  },
  // 修改用户信息
  {
    path: "/setuser"//动态路由传参
    , component: setuser,
    // props: true//开启props传参
  },
  // 搜索
  {
    path: '/search',
    component: search,
  },
  //文章详细
  {
    name: atrcle,
    path: '/atrcle/:atrcleID',//动态路由传参
    component: atrcle,
    props: true//开启props传参
  }
]

const router = new VueRouter({
  routes
})

export default router
